using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace IppServer.Host.Configuration
{
    [DataContract]
    internal sealed class AppSettings
    {
        [DataMember(Order = 0)]
        public string BasePrefix { get; set; } = ServerConfig.Default.BasePrefix;

        [DataMember(Order = 1)]
        public bool AutoStart { get; set; }

        [DataMember(Order = 2)]
        public bool RunOnBoot { get; set; }

        [DataMember(Order = 3)]
        public List<PrinterMapping> PrinterMappings { get; set; } = new List<PrinterMapping>();

        [DataMember(Order = 4)]
        public int? LastUsedPort { get; set; }

        [DataMember(Order = 5)]
        public bool EnableMdnsDiscovery { get; set; } = true; // 默认开启mDNS发现服务

        [DataMember(Order = 6)]
        public bool EnableTcp9100Service { get; set; }

        [DataMember(Order = 7)]
        public List<TcpPrinterTask> TcpPrinterTasks { get; set; } = new List<TcpPrinterTask>();

        [DataMember(Order = 8, EmitDefaultValue = true)]
        public IpMacRestriction IpMacRestriction { get; set; } = IpMacRestriction.CreateDefault();

        [DataMember(Order = 9, EmitDefaultValue = false)]
        public string AdminPasswordHash { get; set; } // 管理员密码哈希（SHA256）

        public static AppSettings CreateDefault()
        {
            return new AppSettings();
        }
    }
}

